' Stephen Toub
' Coded and published in January 2007 issue of MSDN Magazine 
' http://msdn.microsoft.com/msdnmag/issues/07/01/PreviewHandlers/default.aspx


Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Imports System.Windows.Forms
Imports System.ComponentModel.Design
Imports System.Runtime.InteropServices
Imports C4F.DevKit.PreviewHandler.PreviewHandlerFramework

Namespace C4F.DevKit.PreviewHandler.PreviewHandlers
    <PreviewHandler("MSDN Magazine Binary Preview Handler", ".bin;.dat", "{FDFA5AAF-8243-415d-B5E5-AF551336BE7B}"), ProgId("C4F.DevKit.PreviewHandler.PreviewHandlers.BinaryPreviewHandler"), Guid("DF9E65B0-7980-4053-9FCF-6E9AF953A9F4"), ClassInterface(ClassInterfaceType.None), ComVisible(True)> _
    Public NotInheritable Class BinaryPreviewHandler
        Inherits FileBasedPreviewHandler
        Protected Overrides Function CreatePreviewHandlerControl() As PreviewHandlerControl
            Return New BinaryPreviewHandlerControl()
        End Function

        Private NotInheritable Class BinaryPreviewHandlerControl
            Inherits FileBasedPreviewHandlerControl
            Public Overrides Sub Load(ByVal file As FileInfo)
                Dim viewer As ByteViewer = New ByteViewer()
                viewer.Dock = DockStyle.Fill
                viewer.SetFile(file.FullName)
                Controls.Add(viewer)
            End Sub
        End Class
    End Class
End Namespace